home *** CD-ROM | disk | FTP | other *** search
/ NeXT Education Software Sampler 1992 Fall / NeXT Education Software Sampler 1992 Fall.iso / Programming / Classes / CryptSums / Example_main.m < prev    next >
Encoding:
Text File  |  1992-05-18  |  1.0 KB  |  46 lines

  1. #ifdef SECURE
  2. #import <c.h>
  3. #import <stdio.h>
  4. #import <appkit/Panel.h>
  5. #import <cryptsum.h>
  6. #endif
  7.  
  8. #import "MyApp.h"
  9.  
  10. void main(int argc, char *argv[])
  11. {
  12.     int status = EXIT_SUCCESS;    
  13. #ifdef SECURE
  14.     char *message = NULL;
  15.  
  16.     switch(status = cs_checkkey("__TEXT", "__text", PASSWORD)) {
  17.         case CS_SUCCESS : break;
  18.         case CS_NOENTRY : message = "No checksum entry present!"; break;
  19.         case CS_NOSECTION : message = "Attempt to checksum nonexistant section!"; break;
  20.         case CS_NOCHECKSUM : message = "No checksum information available!"; break;
  21.         case CS_NOMATCH : message = "Checksum invalid!"; break;
  22.         case CERROR :
  23.         default : message = "Unknown system error in checksum routine!"; break;
  24.         }
  25. #endif
  26.  
  27.     NXApp = [MyApp new]; /* Need Application object to use NXRunAlertPanel */
  28.     
  29. #ifdef SECURE
  30.     if(status == CS_SUCCESS) {
  31. #endif
  32.         [NXApp loadNibSection:"MyApp.nib" owner:NXApp];
  33.         [NXApp run];
  34. #ifdef SECURE
  35.         status == EXIT_SUCCESS;
  36.         }
  37.     else {
  38.         (void) NXRunAlertPanel(NULL, message, NULL, NULL, NULL);
  39.         status = EXIT_FAILURE;
  40.         }
  41. #endif    
  42.     [NXApp free];
  43.         
  44.     exit(status);
  45. }
  46.